package com.qf.fiter;

import com.qf.util.PropertiesUtils;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;

@WebServlet(urlPatterns = "/*")
public class Filter005Encoding implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("编码过滤器");
        request.setCharacterEncoding(PropertiesUtils.getProperties("UTF-8"));
        response.setCharacterEncoding(PropertiesUtils.getProperties("GBK"));

        filterChain.doFilter(request,response);
    }

    @Override
    public void destroy() {

    }
}
